Skip to main content

Vaults

Use an Epicenter vault to store data that is specific to a simulation and has no meaning outside of the simulation.

note

The vault name must be unique within the vault's scope.

learn more

To manage vaults, use the Vault adapter.

Vault contents

Data is stored in a vault in JSON format as a collection of key-value pairs called items.

  • The key of a data item is a string.
  • The value can be any valid JSON data type (i.e., string, number, array, object, etc.).

Updating vaults

note

It is a best practice to call vaultAdapter.update() to update the data stored in the vault and vaultAdapter.updateProperties() to modify the properties of the vault itself.

Updating the container

To update the properties of a vault, call the define() function with the optionals.mutationStrategy set to ALLOW.

tip

The function will only update the values you pass. To avoid changing the vault contents, omit the items parameter.

Updating the data

The update() function is the best option for updating the vault contents because it takes a mutationKey parameter. Pass this parameter to ensure you are updating the latest version of the data.

If your copy of the data is outdated, the function returns a Vault object with the latest data and mutationKey, and the changed property set to false. You must then make a new update request to save your changes.

Both update() and define() take an items parameter of type Items.

  • To set or delete data, use the set property of the Items object.
  • To add data to an array, use the push property.
  • To remove data from an array, use the pop property.
learn more

For more details, read about the Items interface.